Ahmed Mackey, 50, was preparing to go out on a detail when he suffered the medical episode in the county municipal garage just before noon, MyCentralJersey.com reports.
Nearby officers performed CPR on Mackey after he "fell ill," Sheriff Darrin Russo said.
Mackey, of Piscataway, was taken to Robert Wood Johnson University Hospital Somerset, where he died.
Mackey was remembered in a post by the Somerset County Officers Association as "an amazing father, friend and coworker who had the purest of hearts."
Mackey served as president of the New Jersey Juvenile Justice Association and was a member of the Hate Crime Bias Unit and Public Relations team within the Sheriff's Office.
Click here to follow Daily Voice Newark and receive free news updates.